﻿<%@ Page Language="C#" MasterPageFile="~/Site2.Master" AutoEventWireup="true" CodeBehind="Stock.aspx.cs" Inherits="CROSLAND.WebApp.Stock" Title="Untitled Page" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register assembly="IdeaSparx.CoolControls.Web" namespace="IdeaSparx.CoolControls.Web" tagprefix="cc2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphHeader" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cphMainMenu" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="cphTopMenu" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="cphTopContent" runat="server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="cphMain" runat="server">
</asp:Content>

<asp:Content ID="Content7" ContentPlaceHolderID="cphMainLeft" runat="server">
    Seleccione una Jerarquía:
    <asp:UpdateProgress ID="UpdateProgress2" AssociatedUpdatePanelID="upJerarquias"  runat="server">
        <ProgressTemplate>
            <img src="img/loading.gif" alt="Cargando" title="Cargando" />
        </ProgressTemplate>
    </asp:UpdateProgress>

    <div style="height:10px"></div>

    <asp:UpdatePanel ID="upJerarquias" runat="server" UpdateMode="Conditional" >
        <ContentTemplate>
            <div id="jerarquiaDIV">
              <asp:TreeView ID="tvJerarquia" runat="server" NodeIndent="10" OnSelectedNodeChanged="tvJerarquia_SelectedNodeChanged"
                            ExpandDepth="1" OnTreeNodePopulate="tvJerarquia_TreeNodePopulate" >
                <SelectedNodeStyle Font-Underline="False" ForeColor="White" BackColor="ActiveCaption" />
                <NodeStyle Font-Names="Verdana" Font-Size="8pt" NodeSpacing="0px" HorizontalPadding="5px" />
              </asp:TreeView>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>

    <div style="height:20px"></div>
    Lista de Productos Añadidos:
    <div style="height:10px"></div>
    <asp:UpdatePanel ID="upMaterialesSelec" runat="server" UpdateMode="Conditional" >
        <ContentTemplate>
            <asp:DataList ID="dlMaterialesSelec" CssClass="tbl-detalle" runat="server" 
                CellPadding="4" Visible="true"
                 ShowFooter="false" onitemcommand="dlMaterialesSelec_ItemCommand" >
                <HeaderTemplate>
                    <tr>
                        <th colspan="2">
                            Materiales Seleccionados<br />
                            <asp:LinkButton ID="lnkCrearPedido" runat="server" Text="Continuar >>" ToolTip="Click para ir al doc de venta" PostBackUrl="~/DocVenta.aspx" />
                        </th>
                    </tr>
                    <tr><td style="height:20px; vertical-align:middle;" colspan="11"><hr /></td></tr>
                </HeaderTemplate>
                <ItemTemplate>
                <tr>
                    <td style="text-align:center;">
                        <asp:ImageButton ID="ImageButton1" ImageAlign="Middle" ImageUrl="~/img/del.png" runat="server" CommandName="DelItem" ToolTip='<%# Bind("Posicion") %>' />
                    </td>
                    <td>
                        <asp:HiddenField ID="hidMaterialId" runat="server" Value='<%# Bind("CodMaterial") %>' />
                        <asp:Label ID="lblNomMaterial" runat="server" Text='<%# Bind("DescMaterial") %>' ToolTip='<%# Bind("CodMaterial") %>' />
                    </td>
                </tr>
                </ItemTemplate>
                <FooterTemplate>
                    <tr><td style="height:20px" colspan="11"></td></tr>
                    <tr><td colspan="7">No se han seleccionado items...</td></tr>
                </FooterTemplate>
            </asp:DataList>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>

<asp:Content ID="Content8" ContentPlaceHolderID="cphMainBody" runat="server">

    <asp:UpdatePanel ID="upMain" runat="server">
        <ContentTemplate>
            <table cellpadding="2" cellspacing="0">
                <tr>
                    <td colspan="3" style="text-align: right;">&nbsp;</td>
                </tr>
                <tr>
                    <td style="text-align: right; width:120px;">
                        <asp:Label ID="Label6" Text="Código:" runat="server"></asp:Label>
                    </td>
                    <td>
                        <cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender2" runat="server"
                            TargetControlID="txtCodMaterial" WatermarkText="código material...">
                        </cc1:TextBoxWatermarkExtender>
                        <asp:TextBox ID="txtCodMaterial" runat="server" CssClass="inputbox" Width="150px" 
                            MaxLength="18" ontextchanged="txtCodMaterial_TextChanged" AutoPostBack="true" 
                            AutoCompleteType="Search" />
                    </td>
                    <td style="text-align: right;">
                        <asp:Button ID="ibtnBuscar" runat="server" ImageAlign="Middle" OnClick="ibtnBuscar_Click" Text="Buscar" Width="80px" />
                    </td>
                </tr>
                <tr>
                    <td style="text-align: right;">
                        <asp:Label ID="Label2" Text="Descripción:" runat="server"></asp:Label>
                    </td>
                    <td colspan="2">
                        <cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server"
                            TargetControlID="txtMaterial" WatermarkText="buscar material...">
                        </cc1:TextBoxWatermarkExtender>
                        <asp:TextBox ID="txtMaterial" Text="" runat="server" CssClass="inputbox" Width="300" 
                            ontextchanged="txtMaterial_TextChanged" AutoPostBack="true" AutoCompleteType="None" />
                    </td>
                </tr>
                <tr>
                    <td colspan="3" style="text-align: center;">&nbsp;</td>
                </tr>
            </table>
    
            <div style="height:10px"></div>

            <cc2:CoolGridView ID="cgvMateriales" runat="server" Width="100%" Height="300px" DefaultColumnWidth="950px"
                        OnRowCommand="cgvMateriales_RowCommand" OnDataBound="cgvMateriales_DataBound"
                        CssClass="tbl-detalle" AutoGenerateColumns="false" 
                Font-Size="12px" onrowdatabound="cgvMateriales_RowDataBound" >
                <Columns>      
                    <asp:ButtonField ButtonType="Image" HeaderText="" CommandName="AddItem" HeaderStyle-Width="25" HeaderStyle-HorizontalAlign="Center" ImageUrl="~/img/addItem.png" Visible="false" >
                         <HeaderStyle HorizontalAlign="Center" Width="25px" />
                    </asp:ButtonField>                        
                    <asp:TemplateField HeaderText="" HeaderStyle-Width="20px"  ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                              <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/img/detalle.png" CommandName="Detalle" CommandArgument='<%# ((GridViewRow) Container).RowIndex %>'></asp:ImageButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <HeaderTemplate>
                            <table border="1" style="background-color:Transparent;" width="950px" >
                                <tr>
                                    <th style="width:185px; text-align:center">Material</th>
                                    <th style="width:185px; text-align:center">Descripción</th>
                                    <th style="width:70px; text-align:center" runat="server" visible='<%# (((CROSLAND.BL.BE.UsuarioWebBE)Session["UsuarioWeb"]).sector!= "01")?true:false %>'>UM</th>
                                    <th style="width:50px; text-align:center">Marca</th>
                                    <th style="width:70px; text-align:center" runat="server" visible='<%# (((CROSLAND.BL.BE.UsuarioWebBE)Session["UsuarioWeb"]).sector!= "01")?true:false %>'>Modelo</th>
                                    <th style="width:70px; text-align:center" runat="server" visible='<%# (((CROSLAND.BL.BE.UsuarioWebBE)Session["UsuarioWeb"]).sector!= "01")?true:false %>'>Stock</th>
                                    <th style="width:70px; text-align:center" runat="server" visible='<%# (((CROSLAND.BL.BE.UsuarioWebBE)Session["UsuarioWeb"]).sector!= "01")?true:false %>'>P. Lista</th>  
                                    <th style="width:70px; text-align:center" runat="server" visible='<%# (((CROSLAND.BL.BE.UsuarioWebBE)Session["UsuarioWeb"]).sector!= "01")?true:false %>'>Moneda</th>  
                                    <th style="width:70px; text-align:center" runat="server" visible='<%# (((CROSLAND.BL.BE.UsuarioWebBE)Session["UsuarioWeb"]).sector!= "01")?true:false %>'>P. Promo.</th>
                                    <th style="width:110px; text-align:center" runat="server" visible='<%# (((CROSLAND.BL.BE.UsuarioWebBE)Session["UsuarioWeb"]).sector!= "01")?true:false %>'>Moneda</th>  
                                </tr>
                            </table>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <table border="0" style="background-color:Transparent;" width="950px">
                                <tr style="height:5px;" />
                                <tr>
                                    <td style="text-align:center; width:185px; font-size:11px;"><asp:Label ID="lblCodigo" runat="server" Text='<%# Bind("CodMaterialCorto") %>' /></td>
                                    <td style="text-align:left; width:185px; font-size:11px;"><asp:Label ID="lblMaterial" runat="server" Text='<%# Bind("DescMaterial") %>' /></td>
                                    <td style="text-align:center; width:70px;" runat="server" visible='<%# (((CROSLAND.BL.BE.UsuarioWebBE)Session["UsuarioWeb"]).sector!= "01")?true:false %>'><asp:Label ID="lblMedida" runat="server" Text='<%# Bind("CodUMedida") %>' /></td>
                                    <td style="text-align:center; width:50px;"><asp:Label ID="lblMarca" runat="server" Text='<%# Bind("marca") %>' /></td>
                                    <td style="text-align:center; width:70px;" runat="server" visible='<%# (((CROSLAND.BL.BE.UsuarioWebBE)Session["UsuarioWeb"]).sector!= "01")?true:false %>'><asp:Label ID="lblModelo" runat="server" Text='<%# Bind("modelo") %>' /></td>        
                                    <td style="text-align:center; width:70px;" runat="server" visible='<%# (((CROSLAND.BL.BE.UsuarioWebBE)Session["UsuarioWeb"]).sector!= "01")?true:false %>'><asp:Label ID="lblStock" runat="server" Text='<%# Bind("Stock", "{0:0,0.00}") %>' /></td>
                                    <td style="text-align:center; width:70px;" runat="server" visible='<%# (((CROSLAND.BL.BE.UsuarioWebBE)Session["UsuarioWeb"]).sector!= "01")?true:false %>'><asp:Label ID="lblPlista" runat="server" Text='<%# Bind("Plista", "{0:0,0.00}") %>' /></td>
                                    <td style="text-align:center; width:70px;" runat="server" visible='<%# (((CROSLAND.BL.BE.UsuarioWebBE)Session["UsuarioWeb"]).sector!= "01")?true:false %>'><asp:Label ID="lblMoneda" runat="server" Text='<%# Bind("moneda") %>' /></td>
                                    <td style="text-align:center; width:70px;" runat="server" visible='<%# (((CROSLAND.BL.BE.UsuarioWebBE)Session["UsuarioWeb"]).sector!= "01")?true:false %>'><asp:Label ID="lblPPromo" runat="server" Text='<%# Bind("Ppromo", "{0:0,0.00}") %>' /></td>
                                    <td style="text-align:center; width:110px;" runat="server" visible='<%# (((CROSLAND.BL.BE.UsuarioWebBE)Session["UsuarioWeb"]).sector!= "01")?true:false %>'><asp:Label ID="lblMon" runat="server" Text='<%# Bind("moneda") %>' /></td>
                                </tr>
                                <tr style="height:5px;" />
                                <tr>
                                    <td colspan="10">
                                    <!--
                                        <asp:GridView ID="gvDetalle" runat="server" AutoGenerateColumns="false" CssClass="tbl-detalle"
                                                    Width="100%" GridLines="Both" BackColor="Transparent" Visible="false"                                                    
                                                    EmptyDataText='<%# "Para el material " + Eval("CodMaterialCorto") +  " no existe cadena de Reemplazo." %>' >
                                            <Columns>                     
                                                <asp:BoundField DataField="CodMaterialCorto" HeaderText="Material" />
                                                <asp:BoundField DataField="DescMaterial" HeaderText="Descripción" />
                                                <asp:BoundField DataField="CodUMedida" HeaderText="UM" />
                                                <asp:BoundField DataField="marca" HeaderText="Marca" />
                                                <asp:BoundField DataField="modelo" HeaderText="Modelo" />                                    
                                            </Columns>
                                        </asp:GridView>
                                    -->
                                        <asp:Label ID="lblDetalle" runat="server" Text="" Visible="false"></asp:Label>
                                    </td>
                                </tr>
                            </table>
                        </ItemTemplate>
                   </asp:TemplateField>
                </Columns>
                <PagerSettings Mode="NumericFirstLast" />
                <AlternatingRowStyle BackColor="Beige" />
                <PagerStyle Font-Size="Medium" />
                <HeaderStyle BackColor="Silver" Font-Size="12px" Height="20px" />
                <BoundaryStyle BorderColor="Gray" BorderStyle="Solid" BorderWidth="1px" />
            </cc2:CoolGridView>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>

<asp:Content ID="Content9" ContentPlaceHolderID="cphFooter" runat="server">
</asp:Content>
